package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;

public class ENDWITH extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if ((paramArrayOfObject.length < 2) || (paramArrayOfObject.length > 2))
      return Primitive.ERROR_VALUE;
    String str1 = paramArrayOfObject[0].toString();
    String str2 = paramArrayOfObject[1].toString();
    return Boolean.valueOf(str1.endsWith(str2));
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "ENDWITH(str1，str2):判断字符串str1是否以str2结束。\n备注:\n    str1和str2都是大小写敏感的。\n示例:\nENDWITH(\"FineReport\",\"Report\")等于true。\nENDWITH(\"FineReport\",\"Fine\")等于false。\nENDWITH(\"FineReport\"，\"report\")等于false。";
  }

  public String getEN()
  {
    return "ENDWITH(string1,string2):Judge whether string1 ends with string2.\nIf string1 ends with string2,return true,else return false.\n\nRemarks:\nThe two strings are all Case-insensitive.\n\nExample:\nENDWITH(\"FineReport\",\"Report\") returns true.\nENDWITH(\"FineReport\",\"Fine\") returns false.\nENDWITH(\"FineReport\",\"report\") returns false. ";
  }
}